package de.jmda.gen.java.impl;

import static org.junit.Assert.assertTrue;

import org.apache.log4j.Logger;
import org.junit.Test;

import de.jmda.gen.GeneratorException;
import de.jmda.gen.java.TypeKindGenerator;

public class JUTDefaultPublicTopLevelTypeDeclarationGenerator
{
	private final static Logger LOGGER =
      Logger.getLogger(JUTDefaultPublicTopLevelTypeDeclarationGenerator.class);

	@Test
	public void testDefaultCompilationUnitTypeGenerator()
			throws GeneratorException
	{
		DefaultCompilationUnitTypeGenerator generator =
				new DefaultCompilationUnitTypeGenerator();

		StringBuffer generated = generator.generate();

		LOGGER.debug("generated [" + generated + "]");

		assertTrue(
				"unexpected type declaration [" + generated + "]",
(
		TypeKindGenerator.CLASS.getTypeKind() + " " +
		DefaultCompilationUnitTypeGenerator.DEFAULT_TYPE_NAME + System.lineSeparator() +
		"{"                                                   + System.lineSeparator() +
		"}"
).contentEquals(generated));
	}
}